//****************************************************************************
//Copyright (C) 2005 Adobe Systems, Inc. All Rights Reserved.
//The following is Sample Code and is subject to all restrictions on
//such code as contained in the End User License Agreement accompanying
//this product.
//****************************************************************************

/**
 * VideoViewer, Version 1
 * Creates video object for a Flash Lite 2 application
*/

class VideoViewer extends ImageViewer{
	
	//---------------------------------------------- Properties
	
	private var videoURL:String;			// the video file path
  	private var state:Boolean;				// the state of the video playing, true or false
  
  	//---------------------------------------------- Methods
  	
  	/**
  	 * constructor method
  	 */
  	public function VideoViewer (target:MovieClip, 
                               depth:Number, 
                               x:Number, 
                               y:Number, 
                               w:Number, 
                               h:Number,
                               borderThickness:Number,
                               borderColor:Number,
                               background:Boolean) {
  		super(target, depth, x, y, w, h, borderThickness, borderColor, background);
 		setState(true);			// video is set to play by default
  	}

  	/** 
  	 * load the video
  	 * 
  	 * @param URL	the file path to the video to load
  	 */
  	public function loadVideo (URL:String):Void {
  		_root.videoObject.width = 176;				// default capture setting on Series 60
		_root.videoObject.height = 144;				// default capture setting on Series 60 
		_root.videoObject.play(URL);					// Load the video file into the videoObject object.
  		videoURL = URL;
  	}
  
  	/**
  	 * stop the video playback
  	 * 
  	 */ 
  	public function videoStop():Void {
  		_root.videoObject.stop();
  	}
  
  	/**
  	 * play the video
  	 * 
  	 */ 
  	public function videoPlay():Void {
  		_root.videoObject.play(videoURL);
  	}
  
  	/** 
  	 * pause the video object
  	 * 
  	 */
  	public function videoPause():Void {
  		_root.videoObject.pause();
  	}
  
  	/** 
  	 * resume playback
  	 * 
  	 */
  	public function videoResume():Void {
  		_root.videoObject.resume();
  	}
    
  	/**
  	 * is the video currently playing, or stopped
  	 * 
  	 */
  	public function getState():Boolean {
  		return state;
  	}
  
  	/**
  	 * set the state, true if playing
  	 * 
  	 */
  	public function setState(newState:Boolean):Void {
  		state = newState;
  	}
  
  	/**
  	 * destroy the video object
  	 * 
  	 */
  	public function destroy():Void {
  		_root.videoObject.close();
  		super.destroy();
  	}
}